import type { DemandOrderDto, GetDemandOrderPagedInput, KitInput, UpdateDemandOrderInput } from './models';
import { RestService } from '@abp/ng.core';
import type { PagedResultDto } from '@abp/ng.core';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class ProductionPlatformService {
  apiName = 'BasicArchives';
  

  clearCache = () =>
    this.restService.request<any, void>({
      method: 'DELETE',
      url: '/api/basic-archives/production-platform/clear-cache',
    },
    { apiName: this.apiName });
  

  getList = (input: GetDemandOrderPagedInput) =>
    this.restService.request<any, PagedResultDto<DemandOrderDto>>({
      method: 'GET',
      url: '/api/basic-archives/production-platform/get-list',
      params: { forceRefresh: input.forceRefresh, excludedKitStatuses: input.excludedKitStatuses, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
    },
    { apiName: this.apiName });
  

  kitAnalysis = (input: KitInput) =>
    this.restService.request<any, DemandOrderDto[]>({
      method: 'POST',
      url: '/api/basic-archives/production-platform/kit-analysis',
      body: input,
    },
    { apiName: this.apiName });
  

  updateDemandOrder = (input: UpdateDemandOrderInput) =>
    this.restService.request<any, boolean>({
      method: 'PUT',
      url: '/api/basic-archives/production-platform/update-demand-order',
      body: input,
    },
    { apiName: this.apiName });

  constructor(private restService: RestService) {}
}
